/**
@defgroup detour Detour

Members in this module are wrappers around the standard math library
*/

#ifndef DETOURMATH_H
#define DETOURMATH_H

#include <math.h>
// This include is required because libstdc++ has problems with isfinite
// if cmath is included before math.h.
#include <cmath>
#include "fixed64.h"
#include "fixed_lookuptbl.h"

inline fixed64 dtMathFabsf(const fixed64& x) { return x < 0 ? -x : x; }
inline bool dtMathIsfinite(const fixed64& x)
{
	return x >= fixed64::MIN_VAL && x <= fixed64::MAX_VAL;
}

inline fixed64 dtMathSqrtf(const fixed64& x) { return x.sqrt(); }
inline fixed64 dtMathFloorf(const fixed64& x) { return x.floor(); }
inline fixed64 dtMathCeilf(const fixed64& x) { return x.ceil(); }

inline fixed64 dtMathCosf(fixed64 x) { return fixedCos(x); }
inline fixed64 dtMathSinf(fixed64 x) { return fixedSin(x); }
inline fixed64 dtMathAtan2f(fixed64 y, fixed64 x) { return fixedATan2(y, x); }

#endif
